package com.example.finalsystem.Dao;

import com.example.finalsystem.Entity.Client;
import com.example.finalsystem.Entity.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ClientMapper {
    //    客户
    @Select("select * from `uml_client` where clientid = ${clientId}")
    Client getClientByClientId(Long clientId);
    @Select("select * from `uml_client` where clientid = ${clientId}")
    @Results({
            @Result(property = "deals",column = "clientId",
                    many = @Many(select = "com.example.finalsystem.Dao.DealMapper.findClientIdByClientId" ))
    })
    Client getClientByDeal(Long clientId);
//    以上是一对多方法


    int deleteByPrimaryKey(Long clientid);

    int insert(Client record);

    int insertSelective(Client record);

    Client selectByPrimaryKey(Long clientid);

    int updateByPrimaryKeySelective(Client record);

    int updateByPrimaryKey(Client record);

    @Select("select * from uml_client")
    List<Client> selectAll();
}